package com.ruoyi.project.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.system.mapper.SysCategoryMapper;
import com.ruoyi.project.system.domain.SysCategory;
import com.ruoyi.project.system.service.ISysCategoryService;

/**
 * 商品类别Service业务层处理
 * 
 * @author orange
 * @date 2022-04-07
 */
@Service
public class SysCategoryServiceImpl implements ISysCategoryService 
{
    @Autowired
    private SysCategoryMapper sysCategoryMapper;

    /**
     * 查询商品类别
     * 
     * @param categoryId 商品类别主键
     * @return 商品类别
     */
    @Override
    public SysCategory selectSysCategoryByCategoryId(Long categoryId)
    {
        return sysCategoryMapper.selectSysCategoryByCategoryId(categoryId);
    }

    /**
     * 查询商品类别列表
     * 
     * @param sysCategory 商品类别
     * @return 商品类别
     */
    @Override
    public List<SysCategory> selectSysCategoryList(SysCategory sysCategory)
    {
        return sysCategoryMapper.selectSysCategoryList(sysCategory);
    }

    /**
     * 新增商品类别
     * 
     * @param sysCategory 商品类别
     * @return 结果
     */
    @Override
    public int insertSysCategory(SysCategory sysCategory)
    {
        sysCategory.setCreateTime(DateUtils.getNowDate());
        return sysCategoryMapper.insertSysCategory(sysCategory);
    }

    /**
     * 修改商品类别
     * 
     * @param sysCategory 商品类别
     * @return 结果
     */
    @Override
    public int updateSysCategory(SysCategory sysCategory)
    {
        sysCategory.setUpdateTime(DateUtils.getNowDate());
        return sysCategoryMapper.updateSysCategory(sysCategory);
    }

    /**
     * 批量删除商品类别
     * 
     * @param categoryIds 需要删除的商品类别主键
     * @return 结果
     */
    @Override
    public int deleteSysCategoryByCategoryIds(Long[] categoryIds)
    {
        return sysCategoryMapper.deleteSysCategoryByCategoryIds(categoryIds);
    }

    /**
     * 删除商品类别信息
     * 
     * @param categoryId 商品类别主键
     * @return 结果
     */
    @Override
    public int deleteSysCategoryByCategoryId(Long categoryId)
    {
        return sysCategoryMapper.deleteSysCategoryByCategoryId(categoryId);
    }
}
